#ifndef AST_DECLARATIONS_TYPE_SPECIFIER_H
#define AST_DECLARATIONS_TYPE_SPECIFIER_H


#include "../ASTNode.h"

class StructOrUnionSpecifier;
class EnumSpecifier;
class TypeName;

/*
C99  6.7.2
type-specifier:
		void    |    char |    short    |    int    |    long    |    float    |    signed    |    unsigned    |    _Bool    |    _Complex    |    struct-or-union-specifier    |    enum-specifier    |    typedef-name
*/
class TypeSpecifier : public ASTNode
{
public:
	enum{
		_void,
		_char,
		_short,
		_int,
		_long,
		_float,
		_double,
		_signed,
		_unsigned,
		__Bool,
		__Complex,
		__Imaginary,
		struct_or_union_specifier,
		enum_specifier,
		typedef_name
	};
protected:
	TypeSpecifier(void)
		: ASTNode(ASTNode::type_specifier){};
public:
	TypeSpecifier(int iType)
		: ASTNode(ASTNode::type_specifier)
		, m_iType(iType){};

	TypeSpecifier(StructOrUnionSpecifier * pStruct)
		: ASTNode(ASTNode::type_specifier)
		, m_iType(struct_or_union_specifier)
		, m_pStructOrUnion(pStruct) {};

	TypeSpecifier(EnumSpecifier * pEnum)
		: ASTNode(ASTNode::type_specifier)
		, m_iType(enum_specifier)
		, m_pEnum(pEnum) {};

	TypeSpecifier(TypeName * pType)
		: ASTNode(ASTNode::type_specifier)
		, m_iType(typedef_name)
		, m_pType(pType) {};

	virtual ~TypeSpecifier(void);

	virtual void						codeGen();

protected:
	tiny_int							m_iType;
	union{
		StructOrUnionSpecifier *		m_pStructOrUnion;
		EnumSpecifier *					m_pEnum;
		TypeName *							m_pType;
	};
};


#endif


